/* 
 * File:   im-draw.h
 * Author: gustavo
 *
 * Created on May 28, 2011, 1:57 PM
 */

#ifndef IMDRAW_H
#define	IMDRAW_H

#include "../image.h"
#include "fonts/font.h"

#define __ALPHA_100 	0xFF000000
#define __ALPHA_090 	0xE6000000
#define __ALPHA_080 	0xCC000000
#define __ALPHA_070 	0xB2000000
#define __ALPHA_060 	0x99000000
#define __ALPHA_050 	0x7F000000
#define __ALPHA_040 	0x66000000
#define __ALPHA_030 	0x4C000000
#define __ALPHA_020 	0x33000000
#define __ALPHA_010 	0x19000000
#define __ALPHA_000 	0x00000000


#define _ALPHA_100 	255 * 1.0 << 32
#define _ALPHA_090 	255 * 0.9 << 32
#define _ALPHA_080 	255 * 0.8 << 32
#define _ALPHA_070 	255 * 0.7 << 32
#define _ALPHA_060 	255 * 0.6 << 32
#define _ALPHA_050 	255 * 0.5 << 32
#define _ALPHA_040 	255 * 0.4 << 32
#define _ALPHA_030 	255 * 0.3 << 32
#define _ALPHA_020 	255 * 0.2 << 32
#define _ALPHA_010 	255 * 0.1 << 32
#define _ALPHA_000 	255 * 0.0 << 32

#define GRAY_WHITE 	255 * 1.0
#define GRAY_090 	255 * 0.9
#define GRAY_080 	255 * 0.8
#define GRAY_070 	255 * 0.7
#define GRAY_060 	255 * 0.6
#define GRAY_050 	255 * 0.5
#define GRAY_040 	255 * 0.4
#define GRAY_030 	255 * 0.3
#define GRAY_020 	255 * 0.2
#define GRAY_010 	255 * 0.1
#define GRAY_BLACK 	255 * 0.0

#define RGB_BLACK	0x00000000
#define RGB_BLUE	0x000000FF
#define RGB_GREEN	0x0000FF00
#define RGB_CYAN	0x0000FFFF
#define RGB_RED		0x00FF0000
#define RGB_MAGENTA	0x00FF00FF
#define RGB_YELLOW	0x00FFFF00
#define RGB_WHITE	0x00FFFFFF

#define RGB_ORANGE	0x00FFA500


#ifdef	__cplusplus
extern "C" {
#endif

	typedef struct _color {
		union {
			int px;
			struct {
				unsigned char b;
				unsigned char g;
				unsigned char r;
				unsigned char alpha;
			} rgb;
			unsigned char gray;
		};
	} Color;
	
	Color image_draw_color_new(int color);
	void image_draw_set_color(Color cor);

	inline void image_draw_put_pixel(Image * img, int x, int y);
	void image_draw_line(Image * img, int x0, int y0, int x1, int y1);
	void image_draw_rect(Image * img, int x0, int y0, int x1, int y1);
	void image_draw_cross(Image * img, int x, int y, int ray);
	void image_draw_circle(Image * img, int xm, int ym, int ray);
	void image_draw_ellipse(Image * img, int xc, int yc, int a, int b, double ang);
	
	//int image_draw_print_text(Image * img, int row, int col, char fill_ground, char * image_label);
	void image_draw_print(Image * img, int row, int col, int fillbg, char * template, ...);
	
#ifdef	__cplusplus
}
#endif

#endif	/* IMDRAW_H */

